<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%@ page import="com.scalar.chiptrack.operations.dataentry.forms.FabDataEntryForm,
                 com.scalar.chiptrack.utils.ConfigManager" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>


<chiptrack:checkLogon sourcePage="/searchPurchaseOrders.do"/>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>

<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<script language="javascript">

var dateElement = "";
function openCalendar(dateValue)
{
    dateElement = dateValue;
    newWindow = window.open('<%=chipTracContext%>/jsp/includes/calendar.html','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
    newWindow.moveTo(550,180);
    newWindow.focus();
}

function assignDate(passedValue)
{
    dateElement.value=passedValue;
    window.focus();
}

function submitPage()
{
    var errorIndex = document.getElementById('errorIndex');
    var errors = '';

    var validFromDate = document.purchaseOrderSearchForm['validFromDate'].value;
    var validToDate = document.purchaseOrderSearchForm['validToDate'].value;
    var PONumber   = document.purchaseOrderSearchForm.poNumber.value;

    if( PONumber != '')
    {
        if( chkSalesOrderNoBegin ( PONumber ) )
        {
            document.purchaseOrderSearchForm.poNumber.focus();
            document.getElementById("errorIndex").innerHTML  = "<br><li>  PO Number should not start with special characters ";
            return;

        }
        if( chkSalesOrderNo ( PONumber ) == false )
        {
            document.purchaseOrderSearchForm.poNumber.focus();
            document.getElementById("errorIndex").innerHTML  = "<br><li>  Please enter Valid PO Number";
            return;
        }
    }

    if ( chkDate( validFromDate, "Valid-From date","n") == false )
    {
        errors = errors + errMsg;
    }
    if ( chkDate( validToDate, "Valid-To date","n") == false )
    {
        errors = errors + errMsg;
    }

    if( errors != '' )
    {
        errorIndex.innerHTML = errors;
        errorIndex.focus();
        return;
    }

    document.purchaseOrderSearchForm.submit();
}

function showPoForViewPrint( receiptId )
{
    var poViewURL = '<%=chipTracContext%>/purchaseOrderReceipt.do?action=printerFriendly&receiptId='+ receiptId;
    newWindow = window.open (poViewURL,'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,resizable=yes');
    newWindow.focus();
}

function showStaPoForViewPrint( purchaseOrderId, vendorId)
{
    var poViewURL = '<%=chipTracContext%>/purchaseOrders.do?action=printerFriendly&purchaseOrderId='+ purchaseOrderId+'&vendorId='+ vendorId;
    newWindow = window.open (poViewURL,'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,resizable=yes');
    newWindow.focus();
}
</script>

<!-- Top Header Start-->
    <%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
    <TBODY>
    <TR>
	    <td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
            <!-- Side Navigation start -->
                <%@include file="/jsp/finance/purchase_order_menu.jsp" %>
            <!-- end of the side navigations -->

        <TD bgcolor="#ffffff">
            <IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
        <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
        <TD valign="top" width="100%">
            <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
            <BR>

<!-- from here your body starts -->
<html:form name="purchaseOrderSearchForm"  type="com.scalar.chiptrack.finance.openpo.forms.PurchaseOrderSearchForm" action="/searchPurchaseOrders.do?action=OpenPOSearch&search=OpenPO">

            <table border="0" align = "left" width ="100%" >
                <tr><td colspan="5" class="NArialW" align="center">Open Purchase Order Search</td></tr>
	            <tr><td colspan="5">&nbsp;</td></tr>
				<tr><td colspan=5><chiptrack:errors styleClass="NArialL"/></td></tr>
				<tr><td colspan=5><chiptrack:info styleClass="NArialL"/></td></tr>
				<tr><td>&nbsp;</td></td><td colspan=4 id='errorIndex' style='color:red'  class="NArialL"></td></tr>
                <tr><td colspan='5'>&nbsp;</td></tr>
                <tr>
                    <td>&nbsp;</td>
                    <td ><font class = "NArialL">PO Number</font></td>
                    <td>
                        <html:text name="purchaseOrderSearchForm" property="poNumber" size="23" maxlength="50" styleClass="txfield" />
                    </td>
                    <td><font class = "NArialL">Vendor Name </font></td>
                    <td>
                            <html:select name="purchaseOrderSearchForm" property="vendor_id" styleClass="txfield">
                                <option value="-1">--Select Vendor-- </option>
                                <html:options collection = "vendorsList" property="value" labelProperty="label"/>
                            </html:select>
                    </td>
                </tr>
                <tr><td colspan="5">&nbsp;</td></tr>
                <tr>
                    <td>&nbsp;</td>
                    <td ><font class = "NArialL">Valid From</font>
                    </td>
                    <td>
                        <html:text name="purchaseOrderSearchForm" property="validFromDate" size="23" styleClass="txfield"/>
                        <a href="javascript:openCalendar(document.purchaseOrderSearchForm.validFromDate)"><img onMouseOver="window.status='Click here to select date';return true" border="0" align='center' src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a>
                    </td>
                    <td><font class = "NArialL">Valid To</font></td>

                    <td>
                        <html:text name="purchaseOrderSearchForm" property="validToDate" size="23"  styleClass="txfield"/>
                        <a href="javascript:openCalendar(document.purchaseOrderSearchForm.validToDate)"><img onMouseOver="window.status='Click here to select date';return true" border="0" align='center' src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a>
                    </td>
                    </td>
                </tr>
                <tr><td colspan="5">&nbsp;</td></tr>
                <tr>
                    <td colspan = "3">&nbsp;</td>
                    <td><font class = "NArialL">Year </font></td>
                    <td>
                        <html:select name="purchaseOrderSearchForm" property="year" styleClass="txfield">
                            <html:option value="">--All--</html:option>
                            <html:options collection="years" property="value" labelProperty="label" />
                        </html:select>
                    </td>
                </tr><%--
                <tr>
                    <TR align = "center" border="0">
                    <TD  bgColor= "" align="center" colspan = '5'>
                        <html:checkbox name="purchaseOrderSearchForm" property="showExpired" styleClass="txfield"/>
                        <font class = "NArialL">Show Expired Open PO</font>
                    </TR>
                </tr>--%>
                <tr><td colspan="5">&nbsp;</td></tr>
                <tr>
                    <TR align="center" border="0">
                    <TD bgColor="" align="center" colspan = '5'>
                        <A  href="javascript:submitPage()" ><img border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" width="53" height="17" onmouseover="window.status='Click to Create PO';return true" onmouseout="window.status='';return true" title="Click here to Create PO"></A>&nbsp;&nbsp;&nbsp;
                        <A href="javascript:document.purchaseOrderSearchForm.reset()" onMouseOver="window.status='Click to Reset the PO Information';return true" onMouseOut="window.status='';return true" title="Click here to Reset Process Information"><IMG border=0 src="<%=chipTracContext%>/jsp/includes/images/reset.gif"></a>
                    </TD>
                 </TR>
                </tr>
                <tr><td colspan="5">&nbsp;</td></tr>
                <tr>
                    <td colspan = '5' align = "center">
                        <table border = "0"  width = "100%" align = "center" id = "dp">
						<logic:present name="purchaseOrderSearchForm" property="purchaseOrderSearchList">
                            <tr bgcolor="#993333">
                                <td align="center"><font class = "NArialL"><font color = "#FFFFFF">PO Number</font></font></td>
                                <td align="center"><font class = "NArialL"><font color = "#FFFFFF">Vendor Name</font></font></td>
                                <td align="center"><font class = "NArialL"><font color = "#FFFFFF">Open PO Date</font></font></td>
                                <td align="center"><font class = "NArialL"><font color = "#FFFFFF">Valid From </font></font></td>
                                <td align="center"><font class = "NArialL"><font color = "#FFFFFF">Valid To</font></font></td>
                                <td align="center"><font class = "NArialL"><font color = "#FFFFFF">Max $ </font></font></td>
                                <td align="center"><font class = "NArialL"><font color = "#FFFFFF">Remaining $</font></font></td>
                                <td align="center"><font class = "NArialL"><font color = "#FFFFFF">Action</font></font></td>
                            </tr>
                
                        <logic:iterate id="PurchaseOrder" name="purchaseOrderSearchForm" property="purchaseOrderSearchList" indexId="index">
                             <tr  class="txfield" >
                                <td align="center" >
                                    <font class = "NArialL">
                                        <P ALIGN="LEFT">&nbsp;&nbsp;<bean:write name="PurchaseOrder" property="purchaseOrderNumber" />
                                    </font>
                                </td>
                                <td align="center">
                                    <font class = "NArialL">
                                        <P ALIGN="LEFT">&nbsp;&nbsp;<bean:write name="PurchaseOrder" property="vendorName" />
                                    </font>
                                </td>
                                <td align="center">
                                    <font class = "NArialL">
                                        <P ALIGN="LEFT">&nbsp;&nbsp;<bean:write name="PurchaseOrder" property="purchaseOrderDate" />
                                    </font>
                                </td>
                                <td align="center">
                                    <font class = "NArialL">
                                        <P ALIGN="LEFT">&nbsp;&nbsp;<bean:write name="PurchaseOrder" property="validFromDate" />
                                    </font>
                                </td>
                                <td align="center">
                                    <font class = "NArialL">
                                        <P ALIGN="LEFT">&nbsp;&nbsp;<bean:write name="PurchaseOrder" property="validToDate" />
                                    </font>
                                </td>
                                <td align="center">
                                    <font class = "NArialL">
                                        <P ALIGN="RIGHT">&nbsp;&nbsp;<bean:write name="PurchaseOrder" property="poMaxAmt" />
                                    </font>
                                </td>
                                <td align="center">
                                    <font class = "NArialL">
                                        <P ALIGN="RIGHT">&nbsp;&nbsp;<bean:write name="PurchaseOrder" property="poRemainingAmt" />
                                    </font>
                                </td>
                                <td align="center"><font><A href="<%=chipTracContext%>/purchaseOrders.do?action=new&poType=2&vendor_id=<bean:write name="PurchaseOrder" property="vendor_Id"/>&openPurchaseOrder_Id=<bean:write name="PurchaseOrder" property="purchaseOrder_Id"/>" class='NArialS'><img src='<%=chipTracContext%>/jsp/includes/images/spacer.gif' border='0' height='1' width='1'><b>Standard</b></A> </font></td>
                            </tr>
                        </logic:iterate>
                </logic:present>
                        </table>
                    </td>
                </tr>
				<tr><td colspan="5">&nbsp;</td></tr>
				<tr><td colspan="5">&nbsp;</td></tr>
             </table>

</html:form>
<BR><BR><BR>
        </TD>
        <TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
    </TR>
</TABLE>

<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>
